package mercurius.fitness.client.ui.menu.items;

import net.pleso.framework.client.ui.custom.CustomFormWindow;
import net.pleso.framework.client.ui.custom.CustomRBWindow;
import mercurius.fitness.client.Fitness;
import mercurius.fitness.client.rb.message.MessageRB;
import mercurius.fitness.client.rb.summary.forms.ViewSummaryForm;
import mercurius.fitness.client.rb.user.forms.EditUserForm;
import mercurius.fitness.client.ui.RemoteHTMLFrame;
import mercurius.fitness.client.util.Entry;

import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.ui.MenuBar;

public class SettingsMenu extends MenuBar  {

	public SettingsMenu() {
		super(true);
		
	/*	addItem("About ...",new Command() {

			public void execute() {
			//	new CustomRBWindow(new MessageRB()).show();
			}
			
		});
		*/
		
		addItem("Summary",new Command() {

			public void execute() {
				new CustomFormWindow(null,new ViewSummaryForm()).show();
			}
			
		});
		
		
		
		addItem("Edit Mercurius Profile",new Command() {

			public void execute() {
				new CustomFormWindow(null, new EditUserForm(new Integer(-1))).show();
			}
			
		});
		
		
		
		addItem("Edit Moodle Profile",new Command() {

			public void execute() {
				String url = Fitness.get().getURL()+"?action=editmoodleuser";
				if(Fitness.get().getFeedKey().length() > 0) {
					url += "&feedkey=" + Fitness.get().getFeedKey();
				}
				Fitness.open(url);
				//new IFrame("Edit \"Moodle Profile\"", url).show();
			}
		});

		addItem("Mercurius Gadgets",new Command() {

			public void execute() {
				Entry[] entries = null;
				if(Fitness.get().getFeedKey().length() > 0) {
					Entry[] e = {new Entry("action","viewGadgets"),new Entry("feedkey",Fitness.get().getFeedKey())};
					entries = e;
				} else {
					Entry[] e = {new Entry("action","viewGadgets")};
					entries = e;
				}
				
				new RemoteHTMLFrame("Mercurius Gadgets", entries).show();
				
			}

		});
		
		addItem("Application Messages",new Command() {

			public void execute() {
				new CustomRBWindow(new MessageRB()).show();
			}
			
		});
		//
		
	}
}